import VueCookies from "vue-cookies";

/**
 * 判断用户是否登录
 */
const checkUserLoginStatus = function () {
    return VueCookies.isKey("tokenWeb");
};

/**
 * 函数防抖 (只执行最后一次点击)
 */
const Debounce = (fn, t) => {
    let delay = t || 500;
    let timer;
    return function () {
        let args = arguments;
        if (timer) {
            clearTimeout(timer);
        }
        timer = setTimeout(() => {
            timer = null;
            fn.apply(this, args);
        }, delay);
    };
};

export { Debounce, checkUserLoginStatus }